const { resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
  entry: {
    index: './index.js',
    album: './album.js'
  },
  output: {
    filename: '[name].bundle.js',
    path: resolve(__dirname, 'dist')
  },
  resolve: {
    alias: {
      'vue': 'vue/dist/vue.esm-bundler.js'
    }
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Index',
      template: './index.html',
      filename: 'inedx.html',
      chunks: ['index']  // 指定使用 index.bundle.js/
    }),
    new HtmlWebpackPlugin({
      title: 'Album',
      template: './album.html',
      filename: 'album.html',
      chunks: ['album']  // 指定使用 album.bundle.js
    })
  ],
  optimization: {
    splitChunks: {
      chunks: 'all'
    }
  },
  mode: 'development'
}